package be.ipl.eBar.daoimpl;

import java.util.List;

import javax.ejb.Stateless;

import be.ipl.eBar.dao.BrasserieDao;
import be.ipl.eBar.domaine.Brasserie;

@SuppressWarnings("serial")
@Stateless
public class BrasserieDaoImpl extends DaoImpl<Brasserie> implements
		BrasserieDao {

	@Override
	public Brasserie rechercher(String nom) {
		String query = "select b from Brasserie b where b.nom = ?1";
		return super.recherche(query, nom);
	}

	@Override
	public List<Brasserie> lister(String mot) {
		String query = "select b from Brasserie b where lower(b.nom) = ?1 OR lower(b.adresse.rueNumero) = ?1 OR lower(b.adresse.codePostal) = ?1 OR lower(b.adresse.commune) = ?1";
		return super.liste(query, mot);
	}

}
